package com.day0009;

import java.util.ArrayList;

public class GouWuChe  {
    ArrayList<Goods> list=new ArrayList<>();
    public GouWuChe() {

    }

    public GouWuChe(ArrayList<Goods> list) {
        this.list = list;
    }

    public void addGoods(Goods goods){
        list.add(goods);
    }
    public void showGoods(){
        for(Goods g:list){
           g.show();
        }
    }
    public void remove(Goods goods){
        list.remove(goods);
    }
    public void total(){
        int result=0;
        for(Goods g:list){
            result+=g.getPrice();
        }
        System.out.println("总计:"+result);
    }
}
